package com.wgj.android.adapter;

import android.graphics.Color;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;

import com.jiaai.xui.adapter.XRecyclerViewAdapter;
import com.jiaai.xui.adapter.XViewHolder;
import com.wgj.android.R;
import com.wgj.android.entity.ShopAgency;

import java.util.List;

/**
 * Created by Administrator on 2018/3/16.
 */

public class MyAgencyAdapter extends XRecyclerViewAdapter<ShopAgency> {
    public MyAgencyAdapter(@NonNull RecyclerView mRecyclerView, List<ShopAgency> dataLists) {
        super(mRecyclerView, dataLists, R.layout.my_shop_agency_item);
    }

    @Override
    protected void bindData(XViewHolder holder, ShopAgency shopAgency, int i) {
        holder.setImageUrl(R.id.shop_store_icon,shopAgency.getShopavater());
        holder.setText(R.id.shop_name,shopAgency.getShopName());
        holder.setText(R.id.create_tiem,shopAgency.getCreateTime());
        holder.setText(R.id.shopCaption,shopAgency.getShopCaption());
        if(shopAgency.getState()==1){
            holder.setText(R.id.shop_status,"待审核");
        }
        if(shopAgency.getState()==2){
            holder.setText(R.id.shop_status,"通过");
        }
        if(shopAgency.getState()==3){
            holder.setText(R.id.shop_status,"失败");
        }
        if(shopAgency.getType()==1){
            holder.setText(R.id.tv_type,"免费代理");
            holder.setBackgroundColor(R.id.tv_type, Color.GRAY);
        }
        if(shopAgency.getType()==2){
            holder.setText(R.id.tv_type,"创客代理");
            holder.setBackgroundColor(R.id.tv_type, R.color.colorPrimary);
        }
        if(shopAgency.getType()==3){
            holder.setText(R.id.tv_type,"星级代理");
            holder.setBackgroundColor(R.id.tv_type, Color.RED);
        }
    }
}
